<template>
  <div class="home">
    <!-- 轮播图 -->
      <swiper auto loop :aspect-ratio="600/800" :list="imgList" dots-position="center"></swiper>

    <!-- 导航 -->
    <div>
      <ul class="nav-box">
        <li class="nav-item" @click='jumpTo("news")'>
          <i><img src="../assets/imgs/menu01.png" alt=""></i>
          <p>新闻资讯</p>
        </li>
        <li class="nav-item" @click='jumpTo("imgs")'>
          <i><img src="../assets/imgs/menu02.png" alt=""></i>
          <p>图片分享</p>
        </li>
        <li class="nav-item" @click='jumpTo("goods")'>
          <i><img src="../assets/imgs/menu03.png" alt=""></i>
          <p>商品购买</p>
        </li>
        <li class="nav-item">
          <i><img src="../assets/imgs/menu04.png" alt=""></i>
          <p>留言反馈</p>
        </li>
        <li class="nav-item">
          <i><img src="../assets/imgs/menu05.png" alt=""></i>
          <p>视频专区</p>
        </li>
        <li class="nav-item">
          <i><img src="../assets/imgs/menu06.png" alt=""></i>
          <p>联系我们</p>
        </li>
      </ul>
    </div>
    <!-- 底部导航 -->
    <tab-bar></tab-bar>
  </div>
</template>

<script>
// @ is an alias to /src
import TabBar from '../components/tab-bar'
import { Swiper } from 'vux'
export default {
  components: {
    Swiper,
    TabBar
  },
  data () {
    return {
      imgList: [
        {
          url: 'javascript:',
          img:
              'http://m.itcast.cn/images/newslide/homepageandphone/20181528141522828.jpg',
          title: ''
        },
        {
          url: 'javascript:',
          img:
              'http://m.itcast.cn/images/newslide/homepageandphone/20180918170957294.jpg',
          title: ''
        },
        {
          url: 'javascript:',
          img:
              'http://m.itcast.cn/images/newslide/homepageandphone/20184827134845878.jpg',
          title: ''
        }
      ],
      imgList_index: 0
    }
  },
  methods: {
    jumpTo (pathName) {
      this.$router.push({ name: pathName })
    }
  }
}
</script>
<style lang="scss" scoped>
  .home {
    .nav-box {
      display: flex;
      flex-wrap: wrap;
      width: 100%;
      height: 100%;
      .nav-item {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 33.33%;
        margin: 10px 0;
        cursor: pointer;
        p {
          font-size: 20px;
        }
        img {
          width: 60px;
          height: 60px;
        }
      }
    }
  }
</style>
